package com.jjpro.controller.version;

import com.jjpro.annotation.SystemControllerLog;
import com.jjpro.controller.BaseController;
import com.jjpro.entity.version.MessageReq;
import com.jjpro.entity.version.VersionReq;
import com.jjpro.requestservice.VersionRequestService;
import com.jjpro.utils.AppletResult;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;

/**
 * 版本更新控制器
 * Created by Administrator on 2018/4/16.
 */

@RestController
@RequestMapping
public class VersionController extends BaseController{

    @Autowired
    private VersionRequestService versionRequestService;

    private static final Logger LOGGER = LoggerFactory.getLogger(VersionController.class);

    @SystemControllerLog(funcionExplain = "进入获取主页面版本更新")
    @PostMapping(value = "/get/updating")
    public AppletResult updatingVersion(HttpServletRequest request, VersionReq versionReq){
        versionReq=(VersionReq)headUtil.getAllReqHead(request, versionReq);
        return versionRequestService.updatingVersion(versionReq);
    }

    @SystemControllerLog(funcionExplain = "进入获取主页系统消息提示")
    @PostMapping(value = "/get/system")
    public AppletResult systemPrompt(HttpServletRequest request, MessageReq messageReq){
        messageReq =(MessageReq)headUtil.getAllReqHead(request,messageReq);
        return versionRequestService.systemPrompt(messageReq);
    }

}
